/*     */ package com.lmpop.trade.ts_link_group;
/*     */ 
/*     */ import com.lmpop.frame.QueryList;
/*     */ import com.lmpop.frame.SysMap;
/*     */ import com.lmpop.frame.TradeInterf;
/*     */ import com.lmpop.frame.dao.DbmInterf;
/*     */ import com.lmpop.frame.exp.ApplicationException;
/*     */ import java.util.Hashtable;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ 
/*     */ public class Ts_link_groupInfo
/*     */   implements TradeInterf
/*     */ {
/*     */   QueryList queryList;
/*     */ 
/*     */   public Ts_link_groupInfo()
/*     */   {
/*  15 */     this.queryList = new QueryList();
/*     */   }
/*     */ 
/*     */   public SysMap insert(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  24 */     Ts_link_group ts_link_group = new Ts_link_group();
/*  25 */     ts_link_group.setGroup_id(map.getString("group_id"));
/*  26 */     ts_link_group.setGroup_name(map.getString("group_name"));
/*  27 */     ts_link_group.setRemark(map.getString("remark"));
/*     */ 
/*  29 */     String result_code = "0";
/*     */     try {
/*  31 */       insert(dbmMgr, ts_link_group);
/*     */     } catch (ApplicationException e) {
/*  33 */       e.printStackTrace();
/*  34 */       result_code = "1";
/*     */     }
/*  36 */     map.setString("result_code", result_code);
/*  37 */     return map;
/*     */   }
/*     */ 
/*     */   public void insert(DbmInterf dbmMgr, Ts_link_group ts_link_group)
/*     */     throws ApplicationException
/*     */   {
/*  46 */     dbmMgr.update("insertTs_link_group", ts_link_group);
/*     */   }
/*     */ 
/*     */   public SysMap delete(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  56 */     String pkid_string = map.getString("pkid");
/*  57 */     String result_code = "0";
/*     */     try {
/*  59 */       if (!pkid_string.equals("")) {
/*  60 */         String[] pkStr = pkid_string.split("\\|");
/*  61 */         for (int i = 0; i < pkStr.length; i++) {
/*  62 */           if (pkStr[i].equals("")) continue; delete(dbmMgr, pkStr[i]);
/*     */         }
/*     */       }
/*     */     } catch (ApplicationException e) {
/*  66 */       e.printStackTrace();
/*  67 */       result_code = "1";
/*     */     }
/*  69 */     map.setString("result_code", result_code);
/*  70 */     return map;
/*     */   }
/*     */ 
/*     */   public void delete(DbmInterf dbmMgr, String pkid)
/*     */     throws ApplicationException
/*     */   {
/*  79 */     dbmMgr.update("deleteTs_link_group", pkid);
/*     */   }
/*     */ 
/*     */   public SysMap update(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  88 */     Ts_link_group ts_link_group = new Ts_link_group();
/*  89 */     ts_link_group.setGroup_id(map.getString("group_id"));
/*  90 */     ts_link_group.setGroup_name(map.getString("group_name"));
/*  91 */     ts_link_group.setRemark(map.getString("remark"));
/*     */ 
/*  93 */     String result_code = "0";
/*     */     try {
/*  95 */       update(dbmMgr, ts_link_group);
/*     */     } catch (ApplicationException e) {
/*  97 */       e.printStackTrace();
/*  98 */       result_code = "1";
/*     */     }
/* 100 */     map.setString("result_code", result_code);
/* 101 */     return map;
/*     */   }
/*     */ 
/*     */   public void update(DbmInterf dbmMgr, Ts_link_group ts_link_group)
/*     */     throws ApplicationException
/*     */   {
/* 110 */     dbmMgr.update("updateTs_link_group", ts_link_group);
/*     */   }
/*     */ 
/*     */   public List getListByPage(Object obj, int start, int limit)
/*     */   {
/* 120 */     Hashtable ts_link_group = (Hashtable)obj;
/* 121 */     if (start == 0)
/* 122 */       start = 0;
/*     */     else {
/* 124 */       start = (start - 1) * limit;
/*     */     }
/* 126 */     ts_link_group.put("start", Integer.valueOf(start));
/* 127 */     ts_link_group.put("limit", Integer.valueOf(limit));
/* 128 */     return this.queryList.getList("getListByTs_link_groupPage", ts_link_group);
/*     */   }
/*     */ 
/*     */   public int getCountByObj(Object obj)
/*     */   {
/* 139 */     Hashtable ts_link_group = (Hashtable)obj;
/* 140 */     List list = this.queryList.getList("getCountByObjTs_link_group", ts_link_group);
/* 141 */     int count = 0;
/* 142 */     if ((list != null) && (list.size() > 0)) {
/* 143 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 144 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 145 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 148 */     return count;
/*     */   }
/*     */ 
/*     */   public List getListByPk(String pk)
/*     */   {
/* 158 */     return this.queryList.getList("getTs_link_groupByPk", pk);
/*     */   }
/*     */ 
/*     */   public String getListByObj(Object obj)
/*     */   {
/* 167 */     Hashtable params = (Hashtable)obj;
/* 168 */     String up_group_id = "";
/* 169 */     if (params.get("group_id") != null) {
/* 170 */       up_group_id = params.get("group_id").toString();
/*     */     }
/* 172 */     List list = this.queryList.getList("getListByTs_link_groupPage", params);
/* 173 */     String selectString = "";
/* 174 */     int listsize = 0;
/* 175 */     if ((list != null) && (list.size() > 0)) {
/* 176 */       listsize = list.size();
/*     */ 
/* 178 */       for (int i = 0; i < list.size(); i++) {
/* 179 */         Hashtable map = (Hashtable)list.get(i);
/* 180 */         String group_id = ""; String group_name = ""; String remark = "";
/* 181 */         if (map.get("group_id") != null)
/* 182 */           group_id = map.get("group_id").toString();
/* 183 */         if (map.get("group_name") != null)
/*     */         {
/* 185 */           group_name = map.get("group_name").toString();
/* 186 */           if (group_name.length() > 20)
/*     */           {
/* 188 */             group_name = group_name.substring(0, 20);
/*     */           }
/*     */         }
/* 191 */         if (map.get("remark") != null) remark = map.get("remark").toString();
/* 192 */         if (up_group_id.equals(group_id))
/* 193 */           selectString = selectString + "<option selected value=" + group_id + ">" + group_name + "</option>";
/*     */         else {
/* 195 */           selectString = selectString + "<option value=" + group_id + ">" + group_name + "</option>";
/*     */         }
/*     */       }
/*     */     }
/*     */ 
/* 200 */     return selectString;
/*     */   }
/*     */ 
/*     */   public String getSelectItemByID(String param_attr, String paraKey, String paraValue)
/*     */   {
/* 205 */     String selectItems = "";
/* 206 */     Map comm = new Hashtable();
/* 207 */     comm.put("param_attr", param_attr);
/* 208 */     List list = this.queryList.getList("getCommparaByParam_attr", comm);
/* 209 */     Hashtable objMap = new Hashtable();
/* 210 */     String sKey = "";
/* 211 */     String sValue = "";
/* 212 */     if ((list != null) && (list.size() > 0)) {
/* 213 */       for (int i = 0; i < list.size(); i++) {
/* 214 */         objMap = (Hashtable)list.get(i);
/* 215 */         if (objMap.get(paraKey) != null) {
/* 216 */           sKey = objMap.get(paraKey).toString();
/*     */         }
/* 218 */         if (objMap.get(paraValue) != null) {
/* 219 */           sValue = objMap.get(paraValue).toString();
/*     */         }
/* 221 */         if (paraKey.equals(sKey))
/* 222 */           selectItems = selectItems + "<option selected value=" + sKey + ">" + sValue + "</option>";
/*     */         else {
/* 224 */           selectItems = selectItems + "<option value=" + sKey + ">" + sValue + "</option>";
/*     */         }
/*     */       }
/*     */     }
/* 228 */     return selectItems;
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.trade.ts_link_group.Ts_link_groupInfo
 * JD-Core Version:    0.6.0
 */